<?php
class Vfriend_Session extends Zend_Session
{
	public static function start($intSession = 0)
	{
		if (ini_get('session.auto_start') > 0) {
			session_write_close();
		}
		parent::start();
		if($intSession == 0)
			$strNameSpace = SESSION_VFRIEND_AUTH;
		else
			$strNameSpace = SESSION_ADMIN_AUTH;
		$objStorage = new Zend_Auth_Storage_Session($strNameSpace);
		$AppUI = $objStorage->read();
		if (!isset($AppUI->id)) {
			$AppUI->id 	= 0;
		}
		return $AppUI;
	}

	public static function end($intSession = 0)
	{
		if ($intSession == 0) 
			$strNameSpace = SESSION_VFRIEND_AUTH;
		else
			$strNameSpace = SESSION_ADMIN_AUTH;
		$objStorage = new Zend_Auth_Storage_Session($strNameSpace);
		$objStorage->clear();
	}
}
?>